<template>
  <div class="Page Confirm">
    <div class="Title">
      <h1 class="fl f18">订单确认</h1>
      <img src="~/assets/img/cart_setp2.png" class="fr">
      <div class="clear"></div>
    </div>
    <form name="flowForm" id="flowForm" method="post" action="">
      <table class="GoodList">
        <tbody>
        <tr>
          <td colspan="3" class="teacher">出行人：{{order.nickname}}</td>
        </tr>
        <tr>
          <th class="name">商品</th>
          <th class="price">原价</th>
          <th class="priceNew">现价</th>
        </tr>
        </tbody>
        <tbody>
        <tr class="good">
          <td class="name First">
            <a target="_blank" :href="'https://localhost:8030/route/'+order.routeId">
              <img :src="order.routeCover"></a>
            <div class="goodInfo">
              <input type="hidden" class="ids ids_14502" value="14502">
              <a target="_blank" :href="'https://localhost:8030/route/'+ order.routeId">{{order.routeTitle}}</a>
            </div>
          </td>
          <td class="price">
            <p style="text-decoration:line-through;">￥<strong>{{order.totalFee / 0.8}}</strong></p>
          </td>
          <td class="price">
            <p>￥<strong>{{order.totalFee}}</strong></p>
            <span class="discName red">限时8折</span>
          </td>
        </tr>
        <tr>
          <td class="Billing tr" colspan="3">
            <div class="tr">
              <p>共 <strong class="red">1</strong> 件商品，合计<span
                class="red f20">￥<strong>{{order.totalFee}}</strong></span></p>
            </div>
          </td>
        </tr>
        </tbody>
      </table>
      <div class="Finish">
        <div class="fr" id="AgreeDiv">
          
          <label for="Agree"><p class="on"><input type="checkbox" checked="checked">我已阅读并同意<a href="javascript:" target="_blank">《Itrip购买协议》</a></p></label>
        </div>
        <div class="clear"></div>
        <div class="Main fl">
          <div class="fl">
            <a :href="'/route/'+order.routeId">返回路线详情页</a>
          </div>
          <div class="fr">
            <p>共 <strong class="red">1</strong> 件商品，合计<span class="red f20">￥<strong
              id="AllPrice">{{order.totalFee}}</strong></span></p>
          </div>
        </div>
        <input name="score" value="0" type="hidden" id="usedScore">
        <button class="fr redb" type="button" id="submitPay" @click="toPay()">去支付</button>
        <div class="clear"></div>
      </div>
    </form>
  </div>
</template>
<script>
import orderApi from '@/api/order'
export default {
    asyncData({ params, error }) {
        return orderApi.getOrder(params.oid)
            .then(response => {
              console.log(response.data.data)
                return {
                    order: response.data.data.order
                }
            })
    },
    methods:{
      //点击去支付,生成微信支付二维码，此二维码应该在新的窗口打开
      toPay(){
        console.log(this.order.orderNo)
        this.$router.push({path:"/pay/" + this.order.orderNo})
      }
    }
}
</script>
